package com.q.qpicturebackend.exception;

public class ThrowUtils {

    public static void throwIf(boolean condition,RuntimeException runtimeException){
        if(condition){
            throw runtimeException;
        }
    }

    public static void throwIf(boolean condition,ErrorCode errorCode){
        throwIf(condition,new BusinessException(errorCode));
    }

    /**
     *条件成立数据异常
     * @param condition 条件
     * @param errorCode 错误码
     * @param message 错误信息
     */

    public static void throwIf(boolean condition,ErrorCode errorCode,String message){
        throwIf(condition,new BusinessException(errorCode,message));
    }
}
